/*
zigbee.c
offer zigbee conmunication driver
designed by lunanting

-------------------------
2020-07-05 12:22:31
create file
-------------------------
*/
#ifndef __ZIGBEE_H
#define __ZIGBEE_H

#include "../../bsp/base_type.h"
#define ZIGBEE_COM_BUFFER_SIZE (40)     //目前驱动只能定长发，一帧数据包长度为50 byte
/*
临时宏定义后续有配置文件
*/
#define ELECTRIC_CONTROL_CAB    (0x0007)     //电控柜zigBee地址 临时
#define WASHROBOT_01            (0x0001)     //洗车机器人以及风干机，6台机器
#define WASHROBOT_02            (0x0002)
#define WASHROBOT_03            (0x0003)
#define WASHROBOT_04            (0x0004)
#define WASHROBOT_05            (0x0005)
#define WASHROBOT_06            (0x0006)


/********************************callbakc api****************************/
extern void xp_zigbee_recive_string_api(char *str);   //deal recive string api
extern void xp_zigbee_recive_data_api(u8 *data,u8 len);   //deal recive data api



/**************************data type define****************************/
// zigbee mode type
typedef enum{
    zigbee_maste,  //主机模式
    zigbee_terminal,    //终端模式
    zigbee_master_relay,      //主机+中继
    zigbee_terminal_relay,      //终端+中继
}ZIGBEE_mode;



// zigbee class
typedef struct{
    u8 init;    //初始化状态
    u16 local_addr; //本机地址
    ZIGBEE_mode mode;   //工作模式
    int response;   //应答状态

}ZIGBEE_class;

/*******************************function extern****************************/
extern int xp_zigbee_init(ZIGBEE_mode mode,u16 local_addr); //zigbee module init
extern int xp_zigbee_send(u16 target_addr,u8 *data,u8 len); //zigbee send data
extern int xp_zigbee_printf(u16 target_addr,const char *str,...); //zigbee module send format string
extern int xp_zigbee_debug(char *type,char *fun,char *param);   //zigbee debug
extern int xp_zigbee_send_data(u16 target_addr,u8 *data,u8 len);//zigbee module send raw data





#endif
//end of the file
